package homework.Abstract;

abstract class Employee {
    private String name;
    private String id;

    public Employee(String name, String id) {
        this.name = name;
        this.id = id;
    }

    public abstract double calculateSalary();
    @Override
    public String toString() {
        return "Employee [name=" + name + ", id=" + id + "]";
    }
}
class FullTimeEmployee extends Employee {
    private double monthlySalary;
    public FullTimeEmployee(String name, String id, double monthlySalary) {
        super(name, id);
        this.monthlySalary = monthlySalary;
    }
    @Override
    public double calculateSalary() {
        return monthlySalary;
    }
    @Override
    public String toString() {
        return "FullTimeEmployee [monthlySalary=" + monthlySalary + "]";
    }
}
class PartTimeEmployee extends Employee {
    private double hourlyRate;
    private int hoursWorked;
    public PartTimeEmployee(String name, String id, double hourlyRate, int hoursWorked) {
        super(name, id);
        this.hourlyRate = hourlyRate;
        this.hoursWorked = hoursWorked;
    }
    @Override
    public double calculateSalary() {
        return hourlyRate * hoursWorked;
    }
    @Override
    public String toString() {
        return "PartTimeEmployee [hourlyRate=" + hourlyRate + ", hoursWorked=" + hoursWorked + "]";
    }
}
